package com.kfm.pm;

public enum Food {

    FRUIT("水果"),
    VEGETABLE("蔬菜"),
    MEAT("肉");

    private String name;
    Food(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void getCalorie(Food food) {
        switch (food) {
            case VEGETABLE -> System.out.println(1);
            case FRUIT -> System.out.println(0);
            case MEAT -> System.out.println(100);
        }
    }
}

class Test03 {

    public static void main(String[] args) {
        Food food = Food.MEAT;
        Food[] foods = Food.values();
//        for (int i = 0; i < foods.length; i++) {
//            Food.getCalorie(foods[i]);
//        }

        for (Food f : foods) {
            Food.getCalorie(f);
        }

    }

}


